import java.util.function.Function;
import java.util.function.Supplier;

/**
 * @author gorkr
 * @date 2022/07/12 22:41
 **/
public class CircuitBreaker {

    private State state;

    private Config config;

    private Counter counter;

    private long lastOpenedTime;

    public CircuitBreaker(Config config){
        this.counter = new Counter(config.getFailureCount(),config.getFailureTimeInterval());
        this.state = State.CLOSED;
        this.config = config;
    }

//    public <T> T run(Supplier<T> toRun, Function<Throwable, T> fallback){
//        try {
//            if (state  == State.OPEN){
//                // 判断 Half-Open 是否超时、
//            }
//
//
//        }
//    }




}
    